<?php
/** 
 * Logger.
 * @author gemu
 * 
 * 
 */
class Logger
{
//	$message = 'updateItem: '.$item["id"]; 
//	$log_file = '/Users/me/Desktop/myservice.log'; 
//	error_log(date('d/m/Y H:i:s').' '.$message.PHP_EOL, 3, $log_file);

	public static function log($msg, $deep = '0') {
		$trace = debug_backtrace();
		
        $filepath = explode("/", $trace[$deep]["file"]);
        $file = $filepath[count($filepath) - 1];
        $line = $trace[$deep]["line"];
        $function = $trace[$deep]["function"];

        openlog("", LOG_PID, LOG_DAEMON);
        syslog(LOG_DEBUG, "[".$file.":".$line."] ".$msg);
        closelog();
	}
}
?>